package com.example.administrator.familfinalcialmanagement.greendao.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.example.administrator.familfinalcialmanagement.bean.JaveTeacher;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "JAVE_TEACHER".
*/
public class JaveTeacherDao extends AbstractDao<JaveTeacher, Long> {

    public static final String TABLENAME = "JAVE_TEACHER";

    /**
     * Properties of entity JaveTeacher.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property Name = new Property(1, String.class, "name", false, "NAME");
        public final static Property Phone = new Property(2, String.class, "phone", false, "PHONE");
        public final static Property Pwd = new Property(3, String.class, "pwd", false, "PWD");
        public final static Property ClassName = new Property(4, String.class, "className", false, "CLASS_NAME");
        public final static Property SuperPermission = new Property(5, String.class, "superPermission", false, "SUPER_PERMISSION");
        public final static Property One = new Property(6, String.class, "one", false, "ONE");
        public final static Property Two = new Property(7, String.class, "two", false, "TWO");
        public final static Property Three = new Property(8, String.class, "three", false, "THREE");
        public final static Property Four = new Property(9, String.class, "four", false, "FOUR");
        public final static Property Five = new Property(10, String.class, "five", false, "FIVE");
        public final static Property Six = new Property(11, String.class, "six", false, "SIX");
        public final static Property Sevent = new Property(12, String.class, "sevent", false, "SEVENT");
    }


    public JaveTeacherDao(DaoConfig config) {
        super(config);
    }
    
    public JaveTeacherDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"JAVE_TEACHER\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
                "\"NAME\" TEXT," + // 1: name
                "\"PHONE\" TEXT," + // 2: phone
                "\"PWD\" TEXT," + // 3: pwd
                "\"CLASS_NAME\" TEXT," + // 4: className
                "\"SUPER_PERMISSION\" TEXT," + // 5: superPermission
                "\"ONE\" TEXT," + // 6: one
                "\"TWO\" TEXT," + // 7: two
                "\"THREE\" TEXT," + // 8: three
                "\"FOUR\" TEXT," + // 9: four
                "\"FIVE\" TEXT," + // 10: five
                "\"SIX\" TEXT," + // 11: six
                "\"SEVENT\" TEXT);"); // 12: sevent
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"JAVE_TEACHER\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, JaveTeacher entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(2, name);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(3, phone);
        }
 
        String pwd = entity.getPwd();
        if (pwd != null) {
            stmt.bindString(4, pwd);
        }
 
        String className = entity.getClassName();
        if (className != null) {
            stmt.bindString(5, className);
        }
 
        String superPermission = entity.getSuperPermission();
        if (superPermission != null) {
            stmt.bindString(6, superPermission);
        }
 
        String one = entity.getOne();
        if (one != null) {
            stmt.bindString(7, one);
        }
 
        String two = entity.getTwo();
        if (two != null) {
            stmt.bindString(8, two);
        }
 
        String three = entity.getThree();
        if (three != null) {
            stmt.bindString(9, three);
        }
 
        String four = entity.getFour();
        if (four != null) {
            stmt.bindString(10, four);
        }
 
        String five = entity.getFive();
        if (five != null) {
            stmt.bindString(11, five);
        }
 
        String six = entity.getSix();
        if (six != null) {
            stmt.bindString(12, six);
        }
 
        String sevent = entity.getSevent();
        if (sevent != null) {
            stmt.bindString(13, sevent);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, JaveTeacher entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(2, name);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(3, phone);
        }
 
        String pwd = entity.getPwd();
        if (pwd != null) {
            stmt.bindString(4, pwd);
        }
 
        String className = entity.getClassName();
        if (className != null) {
            stmt.bindString(5, className);
        }
 
        String superPermission = entity.getSuperPermission();
        if (superPermission != null) {
            stmt.bindString(6, superPermission);
        }
 
        String one = entity.getOne();
        if (one != null) {
            stmt.bindString(7, one);
        }
 
        String two = entity.getTwo();
        if (two != null) {
            stmt.bindString(8, two);
        }
 
        String three = entity.getThree();
        if (three != null) {
            stmt.bindString(9, three);
        }
 
        String four = entity.getFour();
        if (four != null) {
            stmt.bindString(10, four);
        }
 
        String five = entity.getFive();
        if (five != null) {
            stmt.bindString(11, five);
        }
 
        String six = entity.getSix();
        if (six != null) {
            stmt.bindString(12, six);
        }
 
        String sevent = entity.getSevent();
        if (sevent != null) {
            stmt.bindString(13, sevent);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public JaveTeacher readEntity(Cursor cursor, int offset) {
        JaveTeacher entity = new JaveTeacher( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // name
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // phone
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pwd
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // className
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // superPermission
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // one
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // two
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // three
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // four
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // five
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // six
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // sevent
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, JaveTeacher entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setPhone(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setPwd(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setClassName(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setSuperPermission(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setOne(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setTwo(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setThree(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setFour(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setFive(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setSix(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setSevent(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(JaveTeacher entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(JaveTeacher entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(JaveTeacher entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
